<?php

namespace admin\controllers;

use yii\web\View;

/**
 * controller
 */
class Controller extends \yii\web\Controller
{

    public $plugins = [
        'before' => [
            'metisMenu',
            'slimscroll',
        ],
        'after' => [
            'inspinia',
            'pace',
        ],
    ];
    public $fadeType = 'fadeIn';

    /**
     * @inheritdoc
     */
    public function beforeAction($action)
    {
        if(parent::beforeAction($action)){
            $this->view->params['plugins'] = [];
            $this->view->params['route'] = $action->controller->id;
            return true;
        }

        return false;
    }

    public function getPlugins()
    {
        return array_merge($this->plugins['before'], $this->view->params['plugins'], $this->plugins['after']);
    }
}
